<%@ page contentType="text/html; charset=gb2312" language="java" import="dao.pojo.Files" errorPage="" %>
<%@ page import="java.sql.Date" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Iterator" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <title>�ļ��ϴ�</title>
    <style type="text/css">
        <!--
        .STYLE3 {
            font-size: 21px
        }

        .STYLE5 {
            font-size: 21px;
            color: blue;
        }

        .STYLE9 {
            font-size: 36px;
            color: blue;
        }

        -->
    </style>
</head>

<body>
<table width="90%" height="543" align="center">
    <tr>
        <td width="100%" height="120">
            <%@ include file="embbed/header.jsp" %>
        </td>
    </tr>
    <tr>
        <td height="335" valign="top">
            <table width="100%" height="230" align="center">
                <tr>
                    <td height="51" align="left" valign="bottom"><span class="STYLE5">&nbsp;&nbsp;&nbsp;</span>
                        <span class="STYLE9">Resource            </span>
                        <hr width="70%" color="#6589d1"/>
                    </td>
                </tr>
                <tr>
                    <td height="152" valign="top">
                        <table width="100%">
                            <tr>
                                <td width="7%" height="265">&nbsp;</td>
                                <td width="65%" valign="top">
                                    <table>
                                        <tr>
                                            <td>File Name</td>
                                            <td>|</td>
                                            <td>Descriptions</td>
                                            <td>|</td>
                                            <td>Upload Time</td>
                                            <td>|</td>
                                            <td>Publisher</td>
                                            <td>|</td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <hr/>
                                            </td>
                                        </tr>
                                        <%
                                            ArrayList<Files> fileList = (ArrayList<Files>) session.getAttribute("fileList");
                                            if (fileList == null) out.println("null here");
                                            Iterator<Files> it = fileList.iterator();
                                            while (it.hasNext()) {
                                                Files files = it.next();
                                        %>
                                        <tr>
                                            <td><%=files.getFileName()%>
                                            </td>
                                            <td>|</td>
                                            <td><%=files.getFileInfo()%>
                                            </td>
                                            <td>|</td>
                                            <%
                                                Date submitTime = new Date(files.getSubmitTime().getTime());
                                                GregorianCalendar calendar = new GregorianCalendar();
                                                calendar.setGregorianChange(date);
                                            %>
                                            <td><%=calendar.calendar.YEAR%>-<%=calendar.MONTH%>
                                                -<%=calendar.DAY_OF_MONTH%>&nbsp;<%=calendar.HOUR_OF_DAY%>
                                                :<%=calendar.MINUTE%>:<%=calendar.SECOND%>
                                            </td>
                                            <td>|</td>
                                            <td><%=files.getUser().getUserName()%>
                                            </td>
                                            <td>|</td>
                                            <td><a href="GetFile?file_id=<%=files.getId()%>">Download It!</a></td>
                                        </tr>
                                        <%
                                            }
                                        %>
                                    </table>
                                </td>
                                <td width="28%" valign="top">
                                    <p>
                                        <form action="/FileUpload" enctype="multipart/form-data" method="post">
                                            <input type="file" name="file" maxlength="40"/>
                                            <br/>
                                            <input type="submit" name="upload" value="Start Upload"/>
                                        </form>
                                    </p>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<table width="90%" align="center">
    <tr>
        <td valign="top">
            <%@ include file="embbed/footer.jsp" %>
        </td>
    </tr>
</table>
</body>

</html>
